home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / drawfram / drawfram.frm < prev    next >
Text File  |  1995-05-07  |  15KB  |  509 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    AutoRedraw      =   -1  'True
  4.    BackColor       =   &H00C0C0C0&
  5.    Caption         =   "DrawFrameOn"
  6.    ClientHeight    =   3390
  7.    ClientLeft      =   105
  8.    ClientTop       =   1710
  9.    ClientWidth     =   6645
  10.    Height          =   4080
  11.    Icon            =   0
  12.    Left            =   45
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   3390
  15.    ScaleWidth      =   6645
  16.    Top             =   1080
  17.    Width           =   6765
  18.    Begin TextBox Text1 
  19.       BackColor       =   &H00C0C0C0&
  20.       BorderStyle     =   0  'None
  21.       FontBold        =   0   'False
  22.       FontItalic      =   0   'False
  23.       FontName        =   "MS Sans Serif"
  24.       FontSize        =   8.25
  25.       FontStrikethru  =   0   'False
  26.       FontUnderline   =   0   'False
  27.       ForeColor       =   &H00000000&
  28.       Height          =   705
  29.       Left            =   1380
  30.       MultiLine       =   -1  'True
  31.       TabIndex        =   7
  32.       Text            =   "Text1"
  33.       Top             =   2310
  34.       Width           =   4065
  35.    End
  36.    Begin PictureBox Picture7 
  37.       AutoSize        =   -1  'True
  38.       BackColor       =   &H00C0C0C0&
  39.       BorderStyle     =   0  'None
  40.       Height          =   480
  41.       Left            =   4830
  42.       Picture         =   DRAWFRAM.FRX:0000
  43.       ScaleHeight     =   480
  44.       ScaleWidth      =   480
  45.       TabIndex        =   6
  46.       Top             =   1350
  47.       Width           =   480
  48.    End
  49.    Begin PictureBox Picture5 
  50.       AutoSize        =   -1  'True
  51.       BackColor       =   &H00C0C0C0&
  52.       BorderStyle     =   0  'None
  53.       Height          =   480
  54.       Left            =   3600
  55.       Picture         =   DRAWFRAM.FRX:0302
  56.       ScaleHeight     =   480
  57.       ScaleWidth      =   480
  58.       TabIndex        =   5
  59.       Top             =   1350
  60.       Width           =   480
  61.    End
  62.    Begin PictureBox Picture6 
  63.       AutoSize        =   -1  'True
  64.       BackColor       =   &H00C0C0C0&
  65.       BorderStyle     =   0  'None
  66.       Height          =   480
  67.       Left            =   4215
  68.       Picture         =   DRAWFRAM.FRX:0604
  69.       ScaleHeight     =   480
  70.       ScaleWidth      =   480
  71.       TabIndex        =   0
  72.       Top             =   1350
  73.       Width           =   480
  74.    End
  75.    Begin PictureBox Picture4 
  76.       AutoSize        =   -1  'True
  77.       BackColor       =   &H00C0C0C0&
  78.       BorderStyle     =   0  'None
  79.       Height          =   480
  80.       Left            =   2985
  81.       Picture         =   DRAWFRAM.FRX:0906
  82.       ScaleHeight     =   480
  83.       ScaleWidth      =   480
  84.       TabIndex        =   4
  85.       Top             =   1350
  86.       Width           =   480
  87.    End
  88.    Begin PictureBox Picture3 
  89.       AutoSize        =   -1  'True
  90.       BackColor       =   &H00C0C0C0&
  91.       BorderStyle     =   0  'None
  92.       Height          =   480
  93.       Left            =   2370
  94.       Picture         =   DRAWFRAM.FRX:0C08
  95.       ScaleHeight     =   480
  96.       ScaleWidth      =   480
  97.       TabIndex        =   3
  98.       Top             =   1350
  99.       Width           =   480
  100.    End
  101.    Begin PictureBox Picture2 
  102.       AutoSize        =   -1  'True
  103.       BackColor       =   &H00C0C0C0&
  104.       BorderStyle     =   0  'None
  105.       Height          =   480
  106.       Left            =   1740
  107.       Picture         =   DRAWFRAM.FRX:0F0A
  108.       ScaleHeight     =   480
  109.       ScaleWidth      =   480
  110.       TabIndex        =   2
  111.       Top             =   1350
  112.       Width           =   480
  113.    End
  114.    Begin PictureBox Picture1 
  115.       AutoSize        =   -1  'True
  116.       BackColor       =   &H00C0C0C0&
  117.       BorderStyle     =   0  'None
  118.       Height          =   480
  119.       Left            =   1125
  120.       Picture         =   DRAWFRAM.FRX:120C
  121.       ScaleHeight     =   480
  122.       ScaleWidth      =   480
  123.       TabIndex        =   1
  124.       Top             =   1350
  125.       Width           =   480
  126.    End
  127.    Begin Label Label2 
  128.       BackColor       =   &H00C0C0C0&
  129.       Caption         =   "Label2"
  130.       Height          =   285
  131.       Left            =   2490
  132.       TabIndex        =   9
  133.       Top             =   810
  134.       Width           =   2355
  135.    End
  136.    Begin Label Label1 
  137.       BackColor       =   &H00C0C0C0&
  138.       Caption         =   "Label1"
  139.       FontBold        =   0   'False
  140.       FontItalic      =   0   'False
  141.       FontName        =   "MS Sans Serif"
  142.       FontSize        =   8.25
  143.       FontStrikethru  =   0   'False
  144.       FontUnderline   =   0   'False
  145.       Height          =   465
  146.       Left            =   240
  147.       TabIndex        =   8
  148.       Top             =   120
  149.       Width           =   6195
  150.    End
  151.    Begin Menu menuBar 
  152.       Caption         =   "Color"
  153.       Index           =   0
  154.       Begin Menu menuColor 
  155.          Caption         =   "Black"
  156.          Index           =   0
  157.       End
  158.       Begin Menu menuColor 
  159.          Caption         =   "Dark Blue"
  160.          Index           =   1
  161.       End
  162.       Begin Menu menuColor 
  163.          Caption         =   "Dark Green"
  164.          Index           =   2
  165.       End
  166.       Begin Menu menuColor 
  167.          Caption         =   "Dark Cyan"
  168.          Index           =   3
  169.       End
  170.       Begin Menu menuColor 
  171.          Caption         =   "Dark Red"
  172.          Index           =   4
  173.       End
  174.       Begin Menu menuColor 
  175.          Caption         =   "Dark Purple"
  176.          Index           =   5
  177.       End
  178.       Begin Menu menuColor 
  179.          Caption         =   "Dark Yellow"
  180.          Index           =   6
  181.       End
  182.       Begin Menu menuColor 
  183.          Caption         =   "Light Gray"
  184.          Index           =   7
  185.       End
  186.       Begin Menu menuColor 
  187.          Caption         =   "Dark Gray"
  188.          Index           =   8
  189.       End
  190.       Begin Menu menuColor 
  191.          Caption         =   "Bright Blue"
  192.          Index           =   9
  193.       End
  194.       Begin Menu menuColor 
  195.          Caption         =   "Bright Green"
  196.          Index           =   10
  197.       End
  198.       Begin Menu menuColor 
  199.          Caption         =   "Bright Cyan"
  200.          Index           =   11
  201.       End
  202.       Begin Menu menuColor 
  203.          Caption         =   "Bright Red"
  204.          Index           =   12
  205.       End
  206.       Begin Menu menuColor 
  207.          Caption         =   "Bright Purple"
  208.          Index           =   13
  209.       End
  210.       Begin Menu menuColor 
  211.          Caption         =   "Bright Yellow"
  212.          Index           =   14
  213.       End
  214.       Begin Menu menuColor 
  215.          Caption         =   "Bright White"
  216.          Index           =   15
  217.       End
  218.    End
  219.    Begin Menu menuBar 
  220.       Caption         =   "Exit"
  221.       Index           =   1
  222.    End
  223. End
  224. Option Explicit
  225.  
  226.     Dim Distance As Integer
  227.     Dim Color As Integer
  228.     Dim Pict As Integer
  229.     Dim Msg As String
  230.  
  231. Sub DrawFrameOn (TopLeftControl As Control, BottomRightControl As Control, Style As String, FrameOffset As Integer, Color As Integer)
  232.  
  233.     ' This program has Option Explicit set in the General Declarations
  234.     ' section so every variable has to be explicitly declared before it
  235.     ' is referenced.
  236.     '
  237.     Dim SaveDrawWidth, SaveFillStyle, SaveScaleMode
  238.     Dim Offset, TWIPS As Integer
  239.     Dim xx, yy As Integer
  240.     Dim x1, y1, x2, y2 As Integer
  241.     Dim FrameLeft, FrameTop, FrameWidth, FrameHeight
  242.     
  243.  
  244.     ' Save the FORM's properties so you can restore them when leaving the
  245.     ' sub-routine.
  246.     '
  247.     SaveDrawWidth = DrawWidth
  248.     SaveFillStyle = FillStyle
  249.     SaveScaleMode = ScaleMode
  250.     
  251.     DrawWidth = 1
  252.     FillStyle = 1
  253.     ScaleMode = 1
  254.  
  255.  
  256.     ' Since the Windows scale default is twips and I haven't changed it, you
  257.     ' have to find out the number of twips per pixel there are on your
  258.     ' particular monitor.
  259.     '
  260.     TWIPS = screen.TwipsPerPixelX
  261.     Offset = FrameOffset * TWIPS
  262.  
  263.  
  264.     ' Just as each control has its Left, Top, Width, and Height; you must
  265.     ' find out those dimensions for the Frame.
  266.     FrameLeft = TopLeftControl.Left
  267.     FrameTop = TopLeftControl.Top
  268.     FrameWidth = BottomRightControl.Left + BottomRightCon